package cc.verywell.pureblock.util.unsafe;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import cc.verywell.pureblock.log.Pblog;
import cc.verywell.pureblock.net.AioProvider;

/**
* 
* Copyright 2019 TanYaqiu
* @author TanYaqiu 
* @address flat 601
* @date 2019年3月17日 下午11:14:12
*/
public class UnsafeRun{
	
//	public static void main(String[] str) {
//		System.out.println("aa");
//		new Thread(new UnsafeRun()).start();
//		try {
//			Thread.sleep(2000);
//		} catch (InterruptedException e) {
//			e.printStackTrace();
//		}
//		System.out.println("bb");
//		System.out.println("cc"+MemoryAddressSize);
//	}
//
	
	static public void start() {
		ExecutorService run = Executors.newSingleThreadExecutor();
		run.execute(UnsafeRun::memoryAddressSize);
		//有可以再加;
		run.shutdown();
		try {
			run.awaitTermination(AioProvider.TIME_OUT, TimeUnit.SECONDS);
		} catch (InterruptedException e) {
			if(Pblog.INIT)Pblog.INIT(e);
		}
	}
	
	static public int MemoryAddressSize = 8; //默认8=64bit
	static public boolean isMemoryAddressSize = false; //默认8=64bit
	static public void memoryAddressSize() {
//		System.out.println("预备");
		new UnsafeGetMemoryAddressSize().run();
//		System.out.println("完成"+MemoryAddressSize);
	}
}
